package com.happyscan138.makefun.adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.View;

import java.util.List;

/**
 * Created by Administrator on 2017/3/2.
 */

public class HomeBannerAdapter extends PagerAdapter {

    private List<View> views;

    public HomeBannerAdapter(List<View> views,Context context) {
        this.views = views;
    }
    public Object instantiateItem(View container, int position) {
        final int currentItem = position%views.size();
        ((ViewPager) container).addView(views.get(currentItem));
        return views.get(currentItem);
    }
    public void destroyItem(View container, int position, Object object) {
        ((ViewPager)container).removeView((View) object);
    }
    public int getCount() {
        return Integer.MAX_VALUE;
    }
    public boolean isViewFromObject(View arg0, Object arg1) {
        return(arg0==arg1);
    }
}